using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerCrouchIdleState : PlayerGroundState
{
    public PlayerCrouchIdleState(Player player, PlayerMoveData playerData, StateMachine stateMachine, string animBoolName) : base(player, playerData, stateMachine, animBoolName)
    {
    }

    public override void Enter()
    {
        base.Enter();

        player.SetVelocityZero();
        player.SetBoxColliderData(playerData.crouchColliderOffset, playerData.crouchColliderSize);
    }

    public override void LogicUpdate()
    {
        base.LogicUpdate();
        if (stateMachine.CurrentState != this) { return; }

        if (xInput != 0)
        {
            stateMachine.ChangeState(player.CrouchMoveState);
        }
        else if (yInput == 0 && !isTouchingCeiling)
        {
            stateMachine.ChangeState(player.IdleState);
        }
    }

    public override void Exit()
    {
        base.Exit();

        player.SetBoxColliderData(playerData.standColliderOffset, playerData.standColliderSize);
    }
}
